# encoding: utf-8
"""
@author: yangwei
@contact: yangchen211@126.com
@time: 2021/8/22 3:33 下午
@file: feishu.py
@desc: 
"""
from service.api.http_api import HttpAPI


class FeiShu(HttpAPI):
    token: str = None

    def __init__(self, app_id = 'cli_a1ab4fd8c8f8d00e',app_secret = 'RLNUt0qOLLWVvq7sMdPPJb8lO850zdMG'):
        self.token: str = None
        self.app_id = app_id
        self.app_secret = app_secret

    def get_token(self):
        url = 'https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal'
        if self.token:
            return self.token
        else:
            self.request(
                url=url,
                method='POST',
                json={
                    'app_id':self.app_id,
                    'app_secret':self.app_secret
                }
            )
